import request from '@/utils/request'

// 获取所有权限点
export function getPermissionListApi(params) {
  return request({
    url: '/sys/permission',
    params
  })
}

// 新增权限
export function addPermissionApi(data) {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

// 更新权限
export function updatePermissionApi(data) {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}

// 删除权限
export function delPermissionApi(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}
// 根据id获取权限列表
export function getRoleDetailApi(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'get'
  })
}

// 给角色分配权限
export function assignPermApi(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
